#!/bin/bash
node -v
npm install -g pnpm
pnpm  -v
pnpm install --no-frozen-lockfile

pnpm build-only
catalogue=$(cd `dirname $0`;pwd)
folder="${catalogue##*/}"

echo "-----------------"
echo $catalogue
echo $folder
echo "-----------------"

echo "Copy Folder..."

rm -rf "/home/user1/workspaces/nginx/www/${folder}"

mkdir "/home/user1/workspaces/nginx/www/${folder}"

cp -r ./dist/* "/home/user1/workspaces/nginx/www/${folder}/"


echo "Copy Nginx Config..."
cp ./cms.conf "/home/user1/workspaces/nginx/conf.d"

echo "It's done √"

echo "请重启 Nginx"